Repository navigation
test(runtime): the protocol uninstall door leaves no handler of the package it uninstalls bound - #33844
Conversation
… of the package it uninstalls bound Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5 Request: review · PR #33844 · area S3 · Fixes #33624 · head a8b2316 Test-only measurement pin (premise falsified: the protocol uninstall door withdraws authored handlers and hooks; a binder-held app:ID package is refused 422 before anything moves). Generated by Claude Code |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTjrNnh6b2BkCXFugM Review — PASSHead-sha: Read at the head: the one test file, card #33624, the
Gate to re-run before landing: No must-fix, no should-fix. |
|
domain:server#5 · zhuangjianguo · session_01QsR2jTEivi2wogPpeo3xd5 席位核对ACCEPT and landing · area S3 · 2026-11-15T12:34Z · head
Ready + auto-merge under the area S3 landing line (maintainer, project thread, 2026-11-15T11:06Z). Generated by Claude Code |
… an unserved verb answers the automation domain, as its bare path does (objectstack-ai#33926) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCpddLFmKzR39wJWZpkRMCi)_ Fixes objectstack-ai#33026 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:独立服务器上,带命名空间地址的 `/automation/:ns/:name/runs`、`/automation/:ns/:name/trigger`、`/automation/trigger/:ns/:name` 收到不支持的方法时,改由自动化领域回答(与不带地址的同一路由一致),不再由传输层回答。 - 为什么改:同一路由因写法不同返回两种错误信封、两种 `Allow`;匿名调用者在带地址写法上拿到 405(暴露路由形状)而不是 401。 - 风险与回滚:只在调度器里多声明三条「领域决定所有方法」的路由;已服务的方法照旧;回滚即还原该 PR。 - 先看:`packages/runtime/src/dispatcher-plugin.ts` 新增的三行声明;`automation-every-verb.hono.integration.test.ts` 的新行与命名空间假数据。 - 两分钟验证:`pnpm --filter @objectstack/runtime exec vitest run src/automation-every-verb.hono.integration.test.ts`,预期 57/57 通过。 - 需要你做的:无,席位落地。 ## What changes - `registerAutomationRoutes` (`packages/runtime/src/dispatcher-plugin.ts`) declares three more patterns through `domainDecidesEveryVerb` (objectstack-ai#24228's mechanism): GET `/automation/:ns/:name/runs`, POST `/automation/:ns/:name/trigger`, POST `/automation/trigger/:ns/:name`. These are the addressed shapes (ADR-0150 D5) of the bare rows that were already declared. A verb the router cannot route on them now reaches `dispatch()`, so the anonymous floor answers `401` and the domain's `automationRouteAllow` answers `405` with `Allow: GET` / `Allow: POST` in the dispatcher's envelope. - Measured before the change, on a real Hono socket at `1e65a389`: `DELETE /api/v1/automation/crm/send_digest/runs` answered `405`, `Allow: GET, HEAD`, with an `error.details` envelope, for a signed-in and an anonymous caller alike. The bare `DELETE /api/v1/automation/send_digest/runs` answered the domain's `405 Allow: GET` (signed in) and `401` (anonymous). The domain itself was never at fault: dispatched directly, the addressed shapes already answer its `405` (`automation-addressed-route.test.ts`). The gap was only the transport declaration. No edit to `runtime/src/domains/automation.ts`. ## Tests `automation-every-verb.hono.integration.test.ts` (both prefixes): - Added rows: DELETE / POST / PUT on `/automation/crm/send_digest/runs`, GET on `/automation/crm/send_digest/trigger` and GET on `/automation/trigger/crm/send_digest`. Each row has an anonymous `401` case and a signed-in domain `405` case. - Added controls: a served POST on both addressed triggers runs the flow; GET and DELETE on `/automation/no_such_ns/send_digest/runs` answer the dispatcher's `404 ROUTE_NOT_FOUND`. - `crm` is installed through an ObjectQL registry double answering the holder table the address reads. <details><summary>Ablation, one per declaration (scripts/ablation-replace.mjs, each restored to the HEAD blob with git diff HEAD empty)</summary> - Without `:ns/:name/runs`: `Tests 14 failed | 43 passed (57)`. The failures are every addressed `/runs` row on both prefixes, plus the no-namespace DELETE control. - Without `:ns/:name/trigger`: `Tests 4 failed | 53 passed (57)`. The failures are the anonymous and signed-in GET on `/automation/crm/send_digest/trigger`, on both prefixes. - Without `trigger/:ns/:name`: `Tests 4 failed | 53 passed (57)`. The failures are the anonymous and signed-in GET on `/automation/trigger/crm/send_digest`, on both prefixes. </details> ## Acceptance notes - Same behaviour on a `createHonoApp` host (catch-all): it already handed every verb to `dispatch()`. No change there. ## Verification Readings at `9bdd492b`, the head before the last `origin/main` merge. That merge brought no change to the three files here. - `pnpm --filter @objectstack/runtime typecheck`: exit 0. - `pnpm --filter @objectstack/runtime test`: `Test Files 603 passed (603) / Tests 10934 passed | 19 skipped`. - Direct dependents exercising the dispatcher on Hono: `@objectstack/http-conformance` test, `Test Files 20 passed / Tests 292 passed`. `@objectstack/client` `package-addressing.test.ts`, `83 passed`. - `automation-every-verb.hono.integration.test.ts`: `57 passed (57)`. - eslint on both touched `.ts` files: exit 0. - `dispatch-gates --commands`: 67 run, reconciled with `--ran` (67 derived, 67 run). 65 exit 0. Two NOT MEASURED on prerequisites: `check:dual-build-cjs-loads` needs a full `pnpm build`; `check:type-check-debt`'s inner build never got the lock. Final head `39826829` (merge of `origin/main`, which carries objectstack-ai#33721 and objectstack-ai#33844 in `packages/runtime`): the scoped re-check (closure build, runtime typecheck, the every-verb, addressed-route, contract-mounts, clone-mount and route-ledger suites) is NOT MEASURED. The shared verify lock was held by another worktree's run for over 27 minutes. CI's Test Core runs the package on this head. --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jUZKdq3PK2Sab53cT3)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steedos · project thread
Fixes #33624
Clause-②: no
Metadata-protocol: none
维护者速读
DELETE /api/v1/packages/ID卸载后,该包的脚本动作和 body hook 不再在引擎上运行"。没有改任何运行时代码。unbindAppArtifactHandlers,处理器会挂到重启。实测证伪:这扇门能卸的包(经POST /packages创作的包)的处理器挂在metadata-service名下,卸载时由重载同步撤掉;由运行时绑定器以app:ID绑定的包(install-local 安装或代码包)会被这扇门以 422 只读拒绝,根本卸不掉。所以方案 A 不需要,卡片随本测试关闭。packages/runtime/src/domains/packages-uninstall-handlers-withdrawn.test.ts(两个用例:创作包卸载后动作 404、hook 不再触发、对照包仍运行;绑定器包被 422 拒绝、处理器随包保留)。pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/packages-uninstall-handlers-withdrawn.test.ts,预期 2 passed。What changes
One test file, no runtime code. It answers the card's Step 1 (measure) on a real kernel, through the dispatcher's routes, and pins the answer: the premise does not reproduce, so the card closes with this measurement (the card's own rule: "If it does not reproduce, close this card with the measurement"). Fix A (a
runtime.package-handlersuninstall cleanup) is not taken; no uninstall response'scleanupslist changes.The measurement (origin/main d7e1a5a, this branch adds only the pin)
Composition:
ObjectKernel+ SQL driver (better-sqlite3 in memory) + the realObjectQLPlugin(engine, registry, protocol, authored resync) + the runtimeAppPlugin(default action runner) +HttpDispatcher.dispatchfor every call.POST /api/v1/packages, its script action and body hook saved under it withPUT /api/v1/meta/action|hook/NAME?package=ID. Their handlers are bound under the environment's authored ownermetadata-service, never underapp:ID. AfterDELETE /api/v1/packages/IDanswers200(registryRemoved: true, the action and hook rows inpersisted.deleted):[], was['metadata-service']);POST /api/v1/actions/OBJECT/NAME/RIDanswers404 RESOURCE_NOT_FOUNDand the body did not run;POST /api/v1/data/OBJECTwrite carries only the CONTROL package's stamp (|q, was|p|q);app:ID, registered through themanifestservice withsource: 'marketplace'and bound bybindAppArtifactHandlerswith install-local's own options (whatMarketplaceInstallLocalPlugin's install does): the door answers422 WRITABLE_PACKAGE_REQUIREDbefore anything moves (isWritablePackageis false for any id in the engine'smanifests; a code boot lands there too). The package stays installed, so its handler and hook stay bound and run, which is correct; its own door (DELETE /api/v1/marketplace/install-local/ID) unbinds them. So the binder's owners never reach this door.What withdraws the authored handlers (the area's question about the
metadata:reloadedannouncement from #33546)Two paths each withdraw them before the door answers; either one is enough on its own:
DELETEmakes (announcePackageReload(…, 'uninstalled'),packages.ts), whosemetadata:reloadedsubscriber inObjectQLPluginrunsresyncAuthoredHooks+resyncAuthoredActions(a full teardown and rebind of themetadata-serviceset from the stored rows);onMetadataMutation,state: 'deleted'), which run the same resyncs, fire-and-forget.The announcement is the one the door awaits, so it is what makes the answer deterministic (see Acceptance notes).
H2 (shared cleanup registry)
It exists and both doors walk it:
deletePackagerunsrunUninstallCleanupsatpackages/metadata-protocol/src/protocol-package-uninstall.ts:385; install-local's door runs it throughprotocol.runUninstallCleanups(packages/cloud-connection/src/marketplace-install-local-plugin.ts:3718→:4107). The runtime registersruntime.package-jobs(app-artifact-handlers.ts:2453),runtime.package-stateandruntime.package-datasourcesthere. Noruntime.package-handlersexists, and with the measurement above none is needed.Tests
packages/runtime/src/domains/packages-uninstall-handlers-withdrawn.test.ts, 2 cases, green.packages/cloud-connection/src/marketplace-install-local-uninstall-handlers.test.ts(the real route handler on a real kernel) 6/6 green on this tree: its uninstall leaves no handler underapp:ID.Ablations (one-time, not kept)
Each leg mutated on disk through
scripts/ablation-replace.mjs, objectql legs rebuilt and proved indist/withscripts/ablation-dist-preflight.mjs, restored (git status --porcelainempty,--absenton the rebuiltdist/):state: 'deleted'mutation events (objectql plugin.ts)no handler is left under the uninstalled package's action: expected [ 'metadata-service' ] to deeply equal []DELETE(packages.ts)expected [ 200, undefined ] to deeply equal [ 422, 'WRITABLE_PACKAGE_REQUIRED' ]Acceptance notes
200for a package whose handlers the binder holds underapp:ID. Today that shape is unreachable (ADR-0070 refusal), so nothing is filed.Verification
Local readings: see the os-dev-report comment on #33624 for the gate list with exit codes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jTEivi2wogPpeo3xd5